﻿using System;
using System.Globalization;
using System.Windows.Data;
using System.Windows.Media;

namespace NxChatQQ.Converters
{
    public class FontLevelBorderConverter : IValueConverter
    {
        public SolidColorBrush FouceBrush { get; set; }
        public SolidColorBrush NormalBrush { get; set; }

        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value is double dataValue)
            {
                if (parameter is string str)
                {
                    var limilt = int.Parse(str);

                    if (dataValue > limilt * 25)
                    {
                        return FouceBrush;
                    }
                    else
                    {
                        return NormalBrush;
                    }

                }
            }

            return NormalBrush;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return Binding.DoNothing;
        }
    }
}
